<?php
class RandomStringModel{
    // make the seed for the random generator 
    private static function make_seed()
    {
        list($usec, $sec) = explode(' ', microtime());
      return (float) $sec + ((float) $usec * 100000); 
    } 
    
    // make the password 
    public static function make_token($pass_len) 
    { 
      //seed the random generator 
      mt_srand(RandomStringModel::make_seed()); 
      //create password 
        $password = ""; 
        for ($loop = 0; $loop < $pass_len; $loop++) 
        { 
            switch(mt_rand(0, 2))
            { 
                case 0: $password .= mt_rand(0, 9);            break; // Number (0-9) 
                case 1: $password .= chr(mt_rand(97, 122));    break; // Alpha Lower (a-z) 
                case 2: $password .= chr(mt_rand(65, 90));    break; // Alpha Upper (A-Z) 
            }
        }
      return $password;
    }
    }

?>